package com.dpkit.adapter.orm.definition;

/**
 * 关联关系定义
 */
public class AssociationDefinition {
    private String fieldName;
    private RelationshipType relationshipType;
    private String targetEntity;
    
    // 关联配置
    private String joinColumn;
    private String mappedBy;
    private CascadeType[] cascade;
    private FetchType fetchType = FetchType.LAZY;
    
    // Join表配置（多对多）
    private JoinTableDefinition joinTable;
    
    // 枚举定义
    public enum RelationshipType {
        ONE_TO_ONE, ONE_TO_MANY, MANY_TO_ONE, MANY_TO_MANY
    }
    
    public enum CascadeType {
        ALL, PERSIST, MERGE, REMOVE, REFRESH, DETACH
    }
    
    public enum FetchType {
        EAGER, LAZY
    }

    /*************************** getter and setter  **********************************************/
    public String getFieldName() {
        return fieldName;
    }

    public void setFieldName(String fieldName) {
        this.fieldName = fieldName;
    }

    public RelationshipType getRelationshipType() {
        return relationshipType;
    }

    public void setRelationshipType(RelationshipType relationshipType) {
        this.relationshipType = relationshipType;
    }

    public String getTargetEntity() {
        return targetEntity;
    }

    public void setTargetEntity(String targetEntity) {
        this.targetEntity = targetEntity;
    }

    public String getJoinColumn() {
        return joinColumn;
    }

    public void setJoinColumn(String joinColumn) {
        this.joinColumn = joinColumn;
    }

    public String getMappedBy() {
        return mappedBy;
    }

    public void setMappedBy(String mappedBy) {
        this.mappedBy = mappedBy;
    }

    public CascadeType[] getCascade() {
        return cascade;
    }

    public void setCascade(CascadeType[] cascade) {
        this.cascade = cascade;
    }

    public FetchType getFetchType() {
        return fetchType;
    }

    public void setFetchType(FetchType fetchType) {
        this.fetchType = fetchType;
    }

    public JoinTableDefinition getJoinTable() {
        return joinTable;
    }

    public void setJoinTable(JoinTableDefinition joinTable) {
        this.joinTable = joinTable;
    }

}